package org.languageguide.storage;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;

import org.languageguide.readings.ReadingManager;

public class Test {

	public void execute(){

	      String line = null;
		//set request method 
		try {
			URL url = new URL("http://206.225.81.34/english/vocabulary/weather/"); 
			HttpURLConnection connection = (HttpURLConnection)url.openConnection();
			connection.setRequestMethod("DELETE");
			connection.setRequestProperty("Content-Type", "application/xml"); 
			connection.setDoOutput(true);
			
			connection.connect();
			 BufferedReader rd  = null;
			// connection.getHeaderField(rd);
			  rd  = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			  StringBuilder sb = new StringBuilder();
	        
	          while ((line = rd.readLine()) != null)
	          {
	              sb.append(line + '\n');
	          }
	        
	          System.out.println(sb.toString());
		} catch (ProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		//addReading("My Name is Barney", "singlurity", "fr");
		//addParagraghTagsIfMissing("Virtually all of the few known candy poisoning incidents involved parents who poisoned their own children's candy.\r\n\r\nGames and other activities\r\nApple bobbing is a game often played in connection with Halloween.");
		//storeSentencesToTranslate(26);
		//loadSentenceTranslations(26, "fr");
		new Test().execute();

		//new ReadingManager().storeWordWrappedText(73);
		//	new ReadingManager().storeSentenceWrappedText(76);
		//new ReadingManager().generateAndSaveReading(74, "fr");
		// 
	}

}
